<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        <a-col :span="4">
          <a-form-item label="用户名称">
          <a-input placeholder="请输入用户名称" v-model="queryParam.accountName"></a-input>
          </a-form-item>
        </a-col>
        <a-col :span="4">
          <a-form-item label="运营商">
          <a-input placeholder="请输入运营商" v-model="queryParam.sysOrgCode"></a-input>
          </a-form-item>
        </a-col>
        <a-col :span="4">
          <a-form-item label="提现类型">
            <a-select  v-model="queryParam.withdrawalType" placeholder="请选择提现类型">
                  <a-select-option v-for="(item, index)  in isStartdata" :key="index.toString()" :trigger-change="true" :value="item.id"> {{item.name}}</a-select-option>
          </a-select>
          </a-form-item>
        </a-col>
        <a-col :span="4">
          <a-form-item label="提现状态">
            <a-select v-model="queryParam.withdrawalStatus" placeholder="请选择提现状态">
              <a-select-option v-for="(item, index)  in withdrawalTypedata" :key="index.toString()" :trigger-change="true" :value="item.id"> {{item.name}}</a-select-option>
          </a-select>
          </a-form-item>
        </a-col>
        <a-col :span="6" >
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">{{$t('common.query')}}</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">{{$t('common.reset')}}</a-button>
            </span>
          </a-col>
      </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->


    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
         <template slot="batteryTypeId" slot-scope="text">
          {{typedata(text)}}
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleDetail(record)">审核</a>


        </span>

      </a-table>
    </div>

    <rental-withdrawal-review-modal ref="modalForm" @ok="modalFormOk"></rental-withdrawal-review-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import RentalWithdrawalReviewModal from './modules/RentalWithdrawalReviewModal'
  import { httpAction, getAction } from '@/api/manage'
  export default {
    name: 'RentalWithdrawalReviewList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      RentalWithdrawalReviewModal
    },
    data () {
      return {
        description: '租车退款表管理页面',
        // 表头
        columns: [
          {
            title:'id',
            align:"center",
            dataIndex: 'id'
          },
          {
            title:'提现订单号',
            align:"center",
            dataIndex: 'orderNo'
          },
          {
            title:'微信支付订单号',
            align:"center",
            dataIndex: 'paymentNo'
          },
          {
            title:'用户名称',
            align:"center",
            dataIndex: 'identityName'
          },
          {
            title:'用户手机号',
            align:"center",
            dataIndex: 'accountPhone'
          },
          {
            title:'提现金额(元)',
            align:"center",
            dataIndex: 'amountMoney'
          },
          {
            title:'提现状态',
            align:"center",
            dataIndex: 'withdrawalStatus',
            customRender:function (text) {
              if(text==1){
                return '待审核'
              }else if(text==2){
                return '审核通过'
              }else if(text==3){
                return '审核不通过'
              }else{
                return '提现失败'
              }

            }
          },
         /* {
            title:'提现类型',
            align:"center",
            dataIndex: 'withdrawalType',
            customRender:function (text) {
              if(text==1){
                return '押金退款'
              }else{
                return ''
              }

            }
          },*/
          /*{
            title:'创建时间',
            align:"center",
            dataIndex: 'createTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },*/
          {
            title:'审核备注',
            align:"center",
            dataIndex: 'reviewComment'
          },
         /* {
            title:'审核人名称',
            align:"center",
            dataIndex: 'reviewerName'
          },
          {
            title:'运营商',
            align:"center",
            dataIndex: 'sysOrgCode'
          },*/
          {
            title:'审核时间',
            align:"center",
            dataIndex: 'reviewerTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
        /*  {
            title: this.$t('common.table.actions'),
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }*/
        ],
        url: {
          list: "/rental/rentalWithdrawalReview/list",
          delete: "/rental/rentalWithdrawalReview/delete",
          deleteBatch: "/rental/rentalWithdrawalReview/deleteBatch",
          exportXlsUrl: "/rental/rentalWithdrawalReview/exportXls",
          importExcelUrl: "/rental/rentalWithdrawalReview/importExcel",
          
        },
        withdrawalTypedata:[
          {name:'待审核',id:1},
          {name:'审核通过',id:2},
          {name:'审核不通过',id:3},
          {name:'提现失败',id:4}
        ],
        isStartdata:[
          {name:'押金退款',id:1},
        ],
        typelistdata:[],
        dictOptions:{},
        superFieldList:[],
        datasslist:[],
        queryParam:{
        },
      }
    },
    created() {
     this.gettypelist()

    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let datass=[]
        this.typelistdata.forEach(itme=>{
           datass.push({label:itme.batteryTypeName,value:itme.id})
        })
        // this.datasslist=datass
        let fieldList=[];
        fieldList.push({type:'string',value:'packageCode',text:'套餐编码'})
        // fieldList.push({type:'string',value:'packageDuration',text:'套餐时长'})
        fieldList.push({type:'string',value:'packageName',text:'套餐名称'})
        fieldList.push({type:'int',value:'packagePrice',text:'套餐售价'})
        fieldList.push({type:'select',value:'packageType',text:'套餐类型',options: [
          {label: "包月",value: 1},
          {label: "包季",value: 2},
          {label: "半年",value: 3},
          {label: "包年",value: 4},
        ]})
        fieldList.push({type:'select',value:'isStart',text:'是否启用',options: [
          {label: "是",value: 1},
          {label: "否",value: 2},
        ]})
        fieldList.push({type:'string',value:'updateBy',text:'修改人'})
        fieldList.push({type:'date',value:'createTime',text:'创建时间	'})
        fieldList.push({type:'select',value:'batteryTypeId',text:'电池类型',options:datass})
        fieldList.push({type:'string',value:'createBy',text:'创建人	'})
        this.superFieldList = fieldList
      },
      gettypelist(){
        let that=this;
        httpAction(this.url.typelist,{pageSize:100,pageNo:1},'get').then((res)=>{
             this.typelistdata=res.result.records
             let datass=[]
              this.typelistdata.forEach(itme=>{
                datass.push({name:itme.batteryTypeName,id:itme.id})
              })
              console.log(666,datass)
              this.datasslist=datass
             this.getSuperFieldList();

            }).finally(() => {

            })
      },

      handleDetail:function(record){
        this.$refs.modalForm.edit(record);
        this.$refs.modalForm.title="详情";
        this.$refs.modalForm.disableSubmit = false;
      },
      typedata(rew){
        let data=''
         this.typelistdata.forEach(element => {
           if(element.id==rew){
             data= element.batteryTypeName||''
           }

         });
        return data
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>